package com.jms.model.cms;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import com.jms.model.base.IdEntity;

@Entity
@Table(name = "cms_category")
@DynamicInsert(true)
@DynamicUpdate(true)
public class Tcate extends IdEntity implements java.io.Serializable {

	private String name;
	private String alias; 
	private String path; 
	private String url;
	private String template_index;
	private String template_list;
	private Integer iscreateindex;
	private String keywords;
	private String description;
	private Integer posts;
	private Integer comments;
	private Integer pv;
	private String icon;
	private String level;
	private Integer seq;
	private Tcate cate;
	private Set<Tcate> cates = new HashSet<Tcate>(0);

	
	public Tcate() {
		super();
	}


	public Tcate(String name, String alias, String path, String url,
			String template_index, String template_list, Integer iscreateindex,
			String keywords, String icon, String description,String level, Integer posts,
			Integer comments, Integer pv, Integer seq, Tcate cate,
			Set<Tcate> cates) {
		super();
		this.name = name;
		this.alias = alias;
		this.path = path;
		this.url = url;
		this.template_index = template_index;
		this.template_list = template_list;
		this.iscreateindex = iscreateindex;
		this.keywords = keywords;
		this.description = description;
		this.level = level;
		this.posts = posts;
		this.comments = comments;
		this.pv = pv;
		this.seq = seq;
		this.cate = cate;
		this.cates = cates;
		this.icon = icon;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pid")
	public Tcate getCate() {
		return cate;
	}

	public void setCate(Tcate cate) {
		this.cate = cate;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "cate")
	public Set<Tcate> getCates() {
		return cates;
	}

	public void setCates(Set<Tcate> cates) {
		this.cates = cates;
	}
	public String getName() {
		return name;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}


	public String getLevel() {
		return level;
	}


	public void setLevel(String level) {
		this.level = level;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getAlias() {
		return alias;
	}


	public void setAlias(String alias) {
		this.alias = alias;
	}


	public String getPath() {
		return path;
	}


	public void setPath(String path) {
		this.path = path;
	}


	public String getUrl() {
		return url;
	}


	public void setUrl(String url) {
		this.url = url;
	}


	public String getTemplate_index() {
		return template_index;
	}


	public void setTemplate_index(String template_index) {
		this.template_index = template_index;
	}


	public String getTemplate_list() {
		return template_list;
	}


	public void setTemplate_list(String template_list) {
		this.template_list = template_list;
	}


	public Integer getIscreateindex() {
		return iscreateindex;
	}


	public void setIscreateindex(Integer iscreateindex) {
		this.iscreateindex = iscreateindex;
	}


	public String getKeywords() {
		return keywords;
	}


	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}


	public String getDescription() {
		return description;
	}


	public void setDescription(String description) {
		this.description = description;
	}


	public Integer getPosts() {
		return posts;
	}


	public void setPosts(Integer posts) {
		this.posts = posts;
	}


	public Integer getComments() {
		return comments;
	}


	public void setComments(Integer comments) {
		this.comments = comments;
	}


	public Integer getPv() {
		return pv;
	}


	public void setPv(Integer pv) {
		this.pv = pv;
	}


	public Integer getSeq() {
		return seq;
	}


	public void setSeq(Integer seq) {
		this.seq = seq;
	}

}